package com.qf.service.impl;

import cn.hutool.crypto.SecureUtil;
import com.qf.dao.UserDao;
import com.qf.dao.impl.UserDaoImpl;
import com.qf.model.User;
import com.qf.service.UserService;

import java.util.ArrayList;

public class UserServiceImpl implements UserService {
    private  UserDao userDao = new UserDaoImpl( );
    public User login(String username, String password) {
        // 处理数据,但是此时没有业务处理
        // 直接传递给dao层
        return userDao.login(username, password);
    }

    public ArrayList<User> findAll() {
        return userDao.findAll();
    }


    public void del(int id) {
         userDao.del(id);
    }

    public boolean regist(User user) {
        String password = user.getPassword();
        String s = SecureUtil.md5(password);
        user.setPassword(s);
        return userDao.regist(user);
    }
}
